package com.liao.ticket.common.exception;

public enum ErrorCode {
    /**
     * 成功   0-999
     */
    SUCCESS(0,"ok",""),

    /**
     * 全局异常     1000-9999
     */
    GLOBAL_ERROR(1000,"全局异常",""),

    GLOBAL_PARAMS_NULL(1100, "参数不能为空", ""),

    /**
     * 用户模块异常   10000-10999
     *      消费者模块异常     11000-11999
     *      机场模块异常     12000-12999
     *      航空公司模块异常     13000-13999
     */
    // 用户模块
    USER_GLOBAL_ERROR(10000, "用户模块异常", ""),
    USER_IDENTITY_UNCERTAIN(10001, "用户身份不明确", ""),
    USER_NO_POWER(10002, "用户无权限", ""),
    USER_PARAMS_FAIL(10003, "参数不合法", ""),
    USER_SIGNING_FAIL(10005, "用户签证验证失败", ""),
    USER_TOKEN_FAIL(10006, "TOKEN不合法", ""),
    USER_IDENTITY_EXPIRE(10007, "身份过期", ""),
    USER_BEAN_COPY_ERROR(10010, "用户对象封装异常", ""),
    USER_REGISTER_PARAMS_FAIL(10020, "用户注册参数不合法", ""),
    USER_REGISTER_EXIT(10021, "用户已存在", ""),
    USER_NO_LOGIN(10100, "用户未登录", ""),
    USER_NO_AUTH(10101, "用户无权限", ""),
    USER_NO_EXIT(10200, "用户不存在", ""),
    USER_UPDATE_PHONE_FAIL(10300, "该手机号已被注册", ""),
    USER_UPDATE_PARAMS_FAIL(10310, "用户信息参数不合法", ""),
    USER_PASSENGER_NO_EXIT(10500, "乘机人不存在", ""),
    USER_PASSENGER_UPDATE_EXIT(10530, "更新乘机人已存在", ""),
    USER_PASSENGER_UPDATE_PARAMS_FAIL(10540, "更新乘机人参数异常", ""),
    USER_PASSENGER_QUERY_PARAMS_FAIL(10550, "查询乘机参数异常", ""),
    USER_PASSENGER_ADD_PARAMS_FAIL(10570, "添加乘机人信息参数异常", ""),
    USER_PASSENGER_ADD_EXIT(10550, "乘机人已存在", ""),

    // 消费者模块
    USER_CONSUMER_ERROR(11000, "消费者模块异常", ""),
    USER_CONSUMER_SQL_ERROR(11100, "消费者模块SQL异常", ""),
    USER_CONSUMER_QUERY_FAIL(11200, "消费者信息查询失败", ""),
    USER_CONSUMER_QUERY_PARAMS_NULL(11201, "消费者信息查询参数为空", ""),
    USER_CONSUMER_NO_EXIT(11501, "消费者不存在", ""),

    // 机场模块
    USER_AIRPORT_ERROR(12000, "机场模块异常", ""),
    USER_AIRPORT_ADD_PARAMS_FAIL(12500, "机场添加参数异常", ""),
    USER_AIRPORT_UPDATE_FAIL(12505, "机场修改修改参数异常", ""),
    USER_AIRPORT_UPDATE_PARAMS_FAIL(12510, "机场修改修改参数异常", ""),
    USER_AIRPORT_ALREADY_EXIT(12550, "该机场已存在", ""),


    // 航空公司模块
    USER_AIRLINE_ERROR(13000, "航空公司模块异常", ""),
    USER_AIRLINE_NO_EXIT(13010, "航空公司不存在", ""),
    USER_AIRLINE_PARAMS_FAIL(13020, "航空公司模块操作参数异常", ""),
    USER_AIRLINE_QUERY_ERROR(13100, "航空公司查询异常", ""),
    USER_AIRLINE_UPDATE_ERROR(13200, "航空公司修改异常", ""),
    USER_AIRLINE_UPDATE_ALREADY_EXIT(13210, "航空公司修改异常，航空公司已存在", ""),
    USER_AIRLINE_ADD_ERROR(13300, "航空公司添加异常", ""),
    USER_AIRLINE_ADD_ALREADY_EXIT(13310, "航空公司添加异常，航空公司已存在", ""),
    USER_AIRLINE_DELETE_ERROR(13400, "航空公司删除异常", ""),


    /**
     * 航班模块异常   20000-20999
     *      历史航班模块异常      21000-22999
     *      实时航班模块异常      23000-24999
     */
    FLIGHT_GLOBAL_ERROR(20000, "航班模块异常", ""),
    FLIGHT_GLOBAL_NO_SEAT_EXIT(20010, "航班舱位异常，该航班未设置舱位", ""),
    FLIGHT_QUERY_ERROR(20100, "航班查询异常", ""),
    FLIGHT_QUERY_PARAMS_FAIL(20110, "航班查询参数异常", ""),
    FLIGHT_QUERY_NO_EXIT(20120, "航班查询异常，航班不存在", ""),
    FLIGHT_UPDATE_ERROR(20200, "航班修改异常", ""),
    FLIGHT_UPDATE_PARAMS_FAIL(20210, "航班修改参数异常", ""),
    FLIGHT_UPDATE_EXIT(20220, "航班修改异常，航班已存在", ""),
    FLIGHT_ADD_ERROR(20300, "航班添加异常", ""),
    FLIGHT_ADD_PARAMS_FAIL(20310, "航班添加参数异常", ""),
    FLIGHT_ADD_EXIT(20320, "航班添加异常，航班已存在", ""),
    FLIGHT_DELETE_ERROR(20400, "航班删除异常", ""),
    FLIGHT_DELETE_PARAMS_FAIL(20410, "航班删除参数异常", ""),

    // 舱位模块
    FLIGHT_SEAT_ERROR(22000, "舱位模块异常", ""),
    FLIGHT_SEAT_NO_EXIT(22010, "舱位不存在", ""),
    FLIGHT_SEAT_QUERY_ERROR(22100, "舱位查询异常", ""),
    FLIGHT_SEAT_QUERY_PARAMS_FAIL(22110, "舱位查询参数异常", ""),
    FLIGHT_SEAT_UPDATE_ERROR(22200, "舱位修改异常", ""),
    FLIGHT_SEAT_UPDATE_PARAMS_FAIL(22210, "舱位修改参数异常", ""),
    FLIGHT_SEAT_UPDATE_EXIT(22220, "舱位修改异常，该级别舱位已存在", ""),
    FLIGHT_SEAT_ADD_ERROR(22300, "舱位添加异常", ""),
    FLIGHT_SEAT_ADD_PARAMS_FAIL(22310, "舱位添加参数异常", ""),
    FLIGHT_SEAT_ADD_EXIT(22320, "舱位添加异常，该级别舱位已存在", ""),
    FLIGHT_SEAT_DELETE_ERROR(22400, "舱位删除异常", ""),
    FLIGHT_SEAT_DELETE_PARAMS_FAIL(22410, "舱位删除参数异常", ""),

    /**
     * 订单模块异常   25000-29999
     */
    ORDER_ERROR(25000, "订单模块异常", ""),
    ORDER_NO_EXIT(25010, "订单不存在", ""),
    ORDER_PARAMS_ERROR(25050, "订单操作参数异常", ""),
    ORDER_QUERY_ERROR(25100, "订单查询异常", ""),
    ORDER_UPDATE_ERROR(25200, "订单修改异常", ""),
    ORDER_ADD_ERROR(25300, "订单添加异常", ""),
    ORDER_ADD_OVERTIME_ERROR(25305, "订单添加异常,订单超时", ""),
    ORDER_ADD_PARAMS_ERROR(25310, "订单添加参数异常", ""),
    ORDER_ADD_NO_SEAT_ERROR(25320, "订单添加异常，舱位不存在", ""),
    ORDER_ADD_NO_SEAT_NUM_ERROR(25325, "订单添加异常，舱位无余票", ""),
    ORDER_ADD_NO_PASSENGER_ERROR(25330, "订单添加异常，乘机人不存在", ""),
    ORDER_ADD_FLIGHT_NO_EXIT_ERROR(25340, "订单添加异常,航班不存在", ""),
    ORDER_CANCEL_OVERTIME(25370, "订单取消失败,下单时间超过12小时", ""),
    ORDER_CANCEL_WILL_FLY(25375, "订单取消失败,航班即将起飞", ""),
    ORDER_CANCEL_STATE_ERROR(25380, "订单取消失败,订单状态异常", ""),

    ORDER_DELETE_ERROR(25400, "订单删除异常", ""),

    /**
     * 系统内部异常   40000-50000
     */
    SYSTEM_ERROR(40000, "系统异常", "");

    private final int code;

    private final String message;

    private final String description;

    ErrorCode(int code, String message,String description){
        this.code = code;
        this.message = message;
        this.description = description;
    }

    public int getCode() {
        return code;
    }

    public String getMessage() {
        return message;
    }

    public String getDescription() {
        return description;
    }
}
